import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
// @ts-ignore
import eslintPlugin from 'vite-plugin-eslint'
import stylelitPlugin from 'vite-plugin-stylelint'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'

import path from 'path'

// eslint-disable-next-line arrow-body-style
export default defineConfig(({ command, mode }) => {
	// let env = loadEnv(mode, process.cwd())
	return {
		plugins: [
			vue(),
			eslintPlugin(),
			stylelitPlugin(),
			createSvgIconsPlugin({
				// 存放svg的目录
				iconDirs: [path.resolve(process.cwd(), 'src/assets/icons/svg')],
				// Specify symbolId format
				symbolId: 'icon-[dir]-[name]',
			}),
		],
		resolve: {
			alias: {
				'@': path.resolve(__dirname, './src'),
			},
		},
		server: {
			host: 'localhost',
			port: 7070,
			open: true,
		},
	}
})
